﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Tradex.Trading;

namespace Tradex.Messages {

    /// <summary>
    /// An AccountUpdateMessage contains updates regarding a specific account.
    /// </summary>
    [Serializable()]
    public sealed class AccountUpdateMessage : Message {

        /// <summary>
        /// Public constructor taking all parameters.
        /// </summary>
        /// <param name="accountKey"></param>
        /// <param name="accountInfo"></param>
        /// <param name="accountUpdate"></param>
        /// <param name="positionInfo"></param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        public AccountUpdateMessage(
            AccountKey accountKey,
            AccountInfo accountInfo = null,
            AccountUpdate accountUpdate = null,
            PositionUpdate positionInfo = null
        ) {
            Account = accountKey;
            Info = accountInfo;
            Update = accountUpdate;
            PositionInfo = positionInfo;
        }

        /// <inheritdoc />
        public override MessageCode Code { get { return MessageCode.AccountUpdate; } }

        /// <summary>
        /// Gets the account key.
        /// </summary>
        public AccountKey Account { get; private set; }

        /// <summary>
        /// Gets the AccountInfo associated with this update.
        /// </summary>
        public AccountInfo Info { get; private set; }
        
        /// <summary>
        /// Gets the account update.
        /// </summary>
        public AccountUpdate Update { get; private set; }

        /// <summary>
        /// Gets the position info.
        /// </summary>
        public PositionUpdate PositionInfo { get; private set; }

    }

}
